package com.ustudy.entity.sns;

import java.util.Collections;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.LongIdEntity;

import com.ustudy.entity.iden.RegUser;

/**
 * 留言
 * @author caizh
 *
 */
@SuppressWarnings("serial")
@Entity(name="LeaveMessage")
@Table(name="SNS_LEAVE_MESSAGE")
public class LeaveMessage extends LongIdEntity {
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="USER_ID")
	private RegUser regUser;
	
	private String title;
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String body;
	
	private Long createTime=System.currentTimeMillis();
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String reply;
	
	private Long replyTime;
	
	private Boolean display=true;
	
	@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="leaveMessage")
	private List<LeaveMessageComment> comments=Collections.emptyList();

	public RegUser getRegUser() {
		return regUser;
	}

	public void setRegUser(RegUser regUser) {
		this.regUser = regUser;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	public String getReply() {
		return reply;
	}

	public void setReply(String reply) {
		this.reply = reply;
	}

	public Long getReplyTime() {
		return replyTime;
	}

	public void setReplyTime(Long replyTime) {
		this.replyTime = replyTime;
	}

	public Boolean getDisplay() {
		return display;
	}

	public void setDisplay(Boolean display) {
		this.display = display;
	}

	public List<LeaveMessageComment> getComments() {
		return comments;
	}

	public void setComments(List<LeaveMessageComment> comments) {
		this.comments = comments;
	}
	
}
